package com.kavitha.model;

public class Calculator {

	private Double a;
	private Double b;
	private Character action;
	
	
	public Double getA() {
		return a;
	}
	public void setA(Double a) {
		this.a = a;
	}
	
	public Double getB() {
		return b;
	}
	public void setB(Double b) {
		this.b = b;
	}
	
	public Double add(){
		return a+b;
	}
	
	public Double sub(){
		return a-b;
	}
	
	public Double mul(){
		return a*b;
	}
	
	public Double div(){
		return a/b;
	}
	
	public Double result(){
		switch (action) {
		case '+':
			return add();
		case '-':
			return sub();
		case '*':
			return mul();
		case '/':
			return div();
		}
		return 0d;
	}
	public Character getAction() {
		return action;
	}
	public void setAction(Character action) {
		this.action = action;
	}
	
}
